<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        let p = new Promise((resolve, reject) => {
            // 用户输入值   
            var num = parseInt(window.prompt('用户输入值'))
            if (num % 2 == 0) {

                // resolve('成功的:' + num)
                setTimeout(() => {
                    resolve('成功的:' + num)

                },1000)
            } else {
                reject('失败的:' + num)
            }


        })

        console.log(p)

        
        // console.log(p)

        

    </script>
</body>

</html>